<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.general.Util" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="bb" class="weaver.general.BaseBean"/>
<jsp:useBean id="resourceInfo" class="weaver.hrm.resource.ResourceComInfo"/>
<%
    String fybxrequestid = Util.null2String( request.getParameter( "fybxrequestid" ) );//requestid
    String requestname = Util.null2String( request.getParameter( "requestname" ) );//requestname
    String sqrid = Util.null2String( request.getParameter( "sqrid" ) );//申请人
    String sqrname = resourceInfo.getLastname(sqrid);//申请人name
    String fyfsrid = Util.null2String( request.getParameter( "fyfsrid" ) );//报销人
    String fyfsrname = resourceInfo.getLastname(fyfsrid);//报销人
    JSONObject jsonData = new JSONObject();
    JSONArray datas = new JSONArray();
    jsonData.put("flag",false);
    if(!"".equals(sqrid) && !"".equals(fyfsrid)){
        if(sqrid.equals(fyfsrid)){
            JSONObject data = new JSONObject();
            data.put("ryid",sqrid);
            data.put("ryname",sqrname);
            data.put("ryxz",0);
            datas.add( data );
        }else {
            JSONObject data1 = new JSONObject();
            data1.put("ryid",sqrid);
            data1.put("ryname",sqrname);
            data1.put("ryxz",0);
            datas.add( data1 );
            JSONObject data2 = new JSONObject();
            data2.put("ryid",fyfsrid);
            data2.put("ryname",fyfsrname);
            data1.put("ryxz",0);
            datas.add( data2 );
        }
    }
    String sql = "select operator from  workflow_requestlog where workflowid='6521' \n" +
            "and nodeid in('5022','5023','5024','5025') and requestid='"+fybxrequestid+"' group by operator";
    rs.executeQuery(sql);
    while (rs.next()){
        JSONObject data = new JSONObject();
        String operator = Util.null2String(rs.getString("operator"));
        String operatorname =resourceInfo.getLastname(operator);
        if(!sqrid.equals(operator)){
            data.put("ryid",operator);
            data.put("ryname",operatorname);
            data.put("ryxz",1);
            datas.add( data );
        }
    }
    jsonData.put("flag",true);
    jsonData.put("fybxrequestid",fybxrequestid);
    jsonData.put("requestname",requestname);
    jsonData.put("datas",datas);
    out.print( jsonData.toJSONString());
    bb.writeLog("jsonData="+jsonData.toJSONString());
%>


